package au.org.nh.dao.inmemory.impl;

import java.util.Collection;
import java.util.HashMap;

import au.org.nh.dao.PatientInfo;
import au.org.nh.dao.PatientInfoDAO;
import au.org.nh.dao.mongo.impl.DBException;

public class PatientInfoInMemoryImpl implements PatientInfoDAO {

	private static HashMap<String, PatientInfo> patientMap = new HashMap<String, PatientInfo>();

	@Override
	public void save(final PatientInfo info) throws DBException {
		if (info != null) {
			patientMap.put(info.getFirstName(), info);
		} else {
			throw new DBException("Null value detected");
		}
	}

	@Override
	public PatientInfo get(final String name) throws DBException {
		return patientMap.get(name);
	}

	@Override
	public Collection<PatientInfo> getAll() {
		return patientMap.values();
	}

	@Override
	public PatientInfo getById(final Long Id) throws DBException {
		// TODO Auto-generated method stub
		return null;
	}

}
